from django.shortcuts import render
from rest_framework.viewsets import ModelViewSet
from .models import Classes
from .serializers import ClassSerializer
from rest_framework.permissions import IsAuthenticated
from users.utils import MyPermission


# Create your views here.
class ClassesViewSet(ModelViewSet):
    # permission_classes = [IsAuthenticated]  # 设置登录才有操作权限
    permission_classes = [MyPermission]  # 设置自定义权限

    queryset = Classes.objects.filter(is_delete=False)  # 数据集
    serializer_class = ClassSerializer  # 序列化器
